﻿@model BackEndNewsCommentsList
<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                @MVCwCMS.Resources.Strings_News.CurrentNews
            </div>
            <div class="panel-body">
                <div class="col-sm-12">
                    @Html.HiddenFor(m => m.NewsId)

                    @Html.BootstrapTextBoxFor(m => m.NewsTitle, isReadOnly: true)
                </div>
            </div>
        </div>

        @using (Html.BootstrapBeginForm(formMethod: FormMethod.Get, isDirtyFormMonitored: false))
        {
            <div class="panel panel-default">
                <div class="panel-body">
                    @Html.BootstrapValidationSummary()

                    @if (ViewData.IsFormVisible())
                    {
                        <div class="col-sm-4">
                            @Html.BootstrapDropDownListFor(m => m.IsActive, FormHelper.GetSelectListForYesNo(), MVCwCMS.Resources.Strings.Any)
                        </div>
                    }
                </div>
                <div class="panel-footer">
                    @if (ViewData.IsFormVisible())
                    {
                        <text>
                            @Html.BootstrapApplyFilter()
                            @Html.BootstrapResetFilter()
                        </text>
                    }
                    @Html.BootstrapButtonRedirect("/Admin/News", MVCwCMS.Resources.Strings_News.News)
                </div>
            </div>
        }
    </div>
</div>
<div class="row">
    <div class="col-lg-12">
        <div class="table-responsive">
            @if (Model.NewsCommentList.IgnoreNulls().Count() > 0)
            {
                using (Html.BootstrapBeginForm("", "", isDirtyFormMonitored: false))
                {
                    @Html.AntiForgeryToken()

                    WebGridHelper webGrid = new WebGridHelper(Model.NewsCommentList, defaultSort: "CommentDate", sortDirection: SortDirection.Descending, rowsPerPage: 10);
                    @webGrid.GetExtendedHtml(
                        columns: webGrid.ExtendedColumns(
                            webGrid.ExtendedColumn("", "", @<text>@Html.BootstrapButtonEdit("/Admin/NewsCommentsEdit/" + item.CommentId as string + "/")</text>, style: "col-10"),
                            webGrid.ExtendedColumn("", "", @<text>@Html.BootstrapButtonDelete("/Admin/NewsCommentsDelete", item.CommentId as object, ((string)item.Comment).TrimToMaxLength(50, "..."))</text>, style: "col-10"),
                            webGrid.ExtendedColumn("IsActive", MVCwCMS.Resources.Strings.Active, format: @<text>@Html.BootstrapIsTicked(item.IsActive as bool?)</text>, style: "col-80 text-center"),
                            webGrid.ExtendedColumn("CommentDate", MVCwCMS.Resources.Strings_News.CommentDate, format: @<text>@ExtensionsHelper.ToDateTimeString(item.CommentDate)</text>, style: "col-140"),
                            webGrid.ExtendedColumn("SubscriptionEmail", MVCwCMS.Resources.Strings_Subscription.SubscriptionEmail),
                            webGrid.ExtendedColumn("FirstName", MVCwCMS.Resources.Strings.FirstName),
                            webGrid.ExtendedColumn("Comment", MVCwCMS.Resources.Strings_News.NewsComment, format: @<text>@(((string)item.Comment).TrimToMaxLength(100, "..."))</text>)
                        )
                    );
                }
            }
        </div>
    </div>
</div>